<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title id="title">gorgeous-doc</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/layui/nprogress/nprogress.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/global.css}">
</head>
<body>
<div class="layui-layout-body">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header header ">
            <div id="header-body">
            </div>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item">
                    <a href="javascript:openSwitch();">切换<!--弹框修改项目分支环境--></a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:updateApi()">更新</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:window.open(context+'manage','3');">设置</a>
                </li>
            </ul>
        </div>
        <div id="menu-body">
        </div>
        <div class="layui-body api-body">
            <!-- 内容主体区域 -->
            <div class="layui-tab layui-tab-brief" lay-filter="api-tab" lay-allowClose="true">
                <ul class="layui-tab-title">
                    <li class="layui-this">主页</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div th:include="doc.html"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<div th:include="common/common.html"></div>
<div th:include="menu/switchTemplate.html"></div>
<div th:include="menu/menuTemplate.html"></div>
<div th:include="api/apiTemplate.html"></div>
<script th:src="@{/js/menu/menu.js}"></script>
<script th:src="@{/js/class/class.js}"></script>
<script th:src="@{/js/project/project.js}"></script>
<script th:src="@{/js/env/env.js}"></script>
<script th:src="@{/js/api/api.js}"></script>

<script type="text/javascript">
    let projectData;
    let envData;
    let currProject = getCurrProject();
    let currProjectData;
    $(function () {

        getEnvAll(data => envData = data)
        projectAll(data => {
            projectData = data;
            //设置当前项目
            setCurrProjectData(currProject);
            //显示菜单
            renderMenu();
            //打开上次的菜单
            let currMenuId = getCurrMenuId(currProject.branchId);
            if (currMenuId) {
                let $menu = $('.api-menu-' + currMenuId);
                $menu.addClass("layui-this").parents(".layui-nav-item").addClass("layui-nav-itemed");
                $menu.parents('.layui-side-scroll').animate({
                    scrollTop: $menu.offset().top - 200
                }, 0);
                openTab(currMenuId);
            }
        })

        //监听tab切换
        element.on('tab(api-tab)', function () {
            let mId = this.getAttribute('lay-id');
            setCurrMenuId(currProject.branchId, mId)
        });
    });
</script>

</html>

